import Index from '../views/Index.vue'

const routes = [
  {
    // 一级路由的重定向
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    name: 'Index',
    component: Index,
    // 二级路由
    children: [
      // 二级路由的重定向
      {
        path: '/index',
        redirect: '/index/my'
      },
      {
        path: '/index/home',
        name: 'Home',
        component: () => import('../views/Index/Home.vue')
      },
      {
        // 收货地址
        path: '/index/home/receiving',
        name: 'Receiving',
        component: () => import('../views/Index/Receiving.vue')
      },
      {
        // 新增地址
        path: '/index/home/newaddress',
        name: 'Newaddress',
        component: () => import('../views/Index/Newaddress.vue')
      },
      {
        path: '/index/find',
        name: 'Find',
        component: () => import('../views/Index/Find.vue')
      },
      {
        path: '/index/order',
        name: 'Order',
        component: () => import('../views/Index/Order.vue')
      },
      {
        path: '/index/my',
        name: 'My',
        component: () => import('../views/Index/My.vue')
      }
    ]
  },
  {
    // 详情页
    path: '/detail/:id',
    name: 'Detail',
    props: true,
    component: () => import('../views/Detail.vue')
  },
  {
    // 登陆页
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    // 搜索页
    path: '/search',
    name: 'Search',
    component: () => import('../views/Search.vue')
  }
]


export default routes;
